//2009/08/22 20:40:10
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class CarBuyer
{
public:
    double lowestCost(vector <string> cars, int fuelPrice, int annualDistance, int years)
    {
        double ret = -1.0;
        for (int i=0; i<cars.size(); i++)
        {
			int a, b, c;
			stringstream s(cars[i]);
			s >> a >> b >> c;
			double temp = ((1.0*fuelPrice * annualDistance) / c) * 1.0 * years+(1.0 * b * years) + 1.0 * a;
			if(temp < ret || ret == -1)
				ret = temp;
        }
		return ret;
    }
};
